/*
    KMC Simulation
    Copyright (c) 2012 Filip Rozbořil

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "Utils.h"

class GridField
{
 	private:
 		int32_t mX, mY;
 		
 	public:
 		GridField(int32_t x, int32_t y) : mX(x), mY(y) { }
		GridField(const GridField& gf) : mX(gf.mX), mY(gf.mY) { }
 		int32_t getx() const { return mX; }
 		int32_t gety() const { return mY; }
 		bool isEvenRow() { return (mY % 2) == 0; }
 		GridField& operator=(const GridField& gf)
 		{
 		 	this->mX = gf.mX;
 		 	this->mY = gf.mY;
 		 	return *this;
 		}
 		
 	friend bool operator==(const GridField& gf1, const GridField& gf2);
};

namespace std 
{
    template <>
        class hash<GridField>
        {
        	public :
            	size_t operator()(const GridField& gf) const
	            {
					uint32_t hash = gf.getx() | (gf.gety() << 16);
					//Trace("[HASH<GRIDFIELD>] Hash code of " <<
					//	gf.getx() << "," << gf.gety() <<
					//	" = " << hash);
	                return hash;
	            }
    		};
};

